// Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use base::ioctl_ioc_nr;

pub const HAX_DEVICE_TYPE: u32 = 0x4000;

ioctl_ioc_nr!(HAX_IOCTL_VERSION, HAX_DEVICE_TYPE, 0x900);
ioctl_ioc_nr!(HAX_IOCTL_CREATE_VM, HAX_DEVICE_TYPE, 0x901);
ioctl_ioc_nr!(HAX_IOCTL_CAPABILITY, HAX_DEVICE_TYPE, 0x910);
ioctl_ioc_nr!(HAX_IOCTL_SET_MEMLIMIT, HAX_DEVICE_TYPE, 0x911);

ioctl_ioc_nr!(HAX_VM_IOCTL_VCPU_CREATE, HAX_DEVICE_TYPE, 0x902);
ioctl_ioc_nr!(HAX_VM_IOCTL_ALLOC_RAM, HAX_DEVICE_TYPE, 0x903);
ioctl_ioc_nr!(HAX_VM_IOCTL_SET_RAM, HAX_DEVICE_TYPE, 0x904);
ioctl_ioc_nr!(HAX_VM_IOCTL_VCPU_DESTROY, HAX_DEVICE_TYPE, 0x905);
ioctl_ioc_nr!(HAX_VM_IOCTL_ADD_RAMBLOCK, HAX_DEVICE_TYPE, 0x913);
ioctl_ioc_nr!(HAX_VM_IOCTL_SET_RAM2, HAX_DEVICE_TYPE, 0x914);
ioctl_ioc_nr!(HAX_VM_IOCTL_PROTECT_RAM, HAX_DEVICE_TYPE, 0x915);

ioctl_ioc_nr!(HAX_VCPU_IOCTL_RUN, HAX_DEVICE_TYPE, 0x906);
ioctl_ioc_nr!(HAX_VCPU_IOCTL_SET_MSRS, HAX_DEVICE_TYPE, 0x907);
ioctl_ioc_nr!(HAX_VCPU_IOCTL_GET_MSRS, HAX_DEVICE_TYPE, 0x908);

ioctl_ioc_nr!(HAX_VCPU_IOCTL_SET_FPU, HAX_DEVICE_TYPE, 0x909);
ioctl_ioc_nr!(HAX_VCPU_IOCTL_GET_FPU, HAX_DEVICE_TYPE, 0x90a);

ioctl_ioc_nr!(HAX_VCPU_IOCTL_SETUP_TUNNEL, HAX_DEVICE_TYPE, 0x90b);
ioctl_ioc_nr!(HAX_VCPU_IOCTL_INTERRUPT, HAX_DEVICE_TYPE, 0x90c);
ioctl_ioc_nr!(HAX_VCPU_SET_REGS, HAX_DEVICE_TYPE, 0x90d);
ioctl_ioc_nr!(HAX_VCPU_GET_REGS, HAX_DEVICE_TYPE, 0x90e);
ioctl_ioc_nr!(HAX_VCPU_IOCTL_KICKOFF, HAX_DEVICE_TYPE, 0x90f);

/* API version 2.0 */
ioctl_ioc_nr!(HAX_VM_IOCTL_NOTIFY_QEMU_VERSION, HAX_DEVICE_TYPE, 0x910);

ioctl_ioc_nr!(HAX_IOCTL_VCPU_DEBUG, HAX_DEVICE_TYPE, 0x916);
ioctl_ioc_nr!(HAX_VCPU_IOCTL_SET_CPUID, HAX_DEVICE_TYPE, 0x917);
ioctl_ioc_nr!(HAX_VM_IOCTL_REGISTER_LOG_FILE, HAX_DEVICE_TYPE, 0x918);
